unit Unit_PowerServerDM;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
  DBClient, PowerSupplyManageSystemServer_TLB, StdVcl, Provider, ADODB, DB;

type
  TPowerServerDM = class(TRemoteDataModule, IPowerServerDM)
    dsAreaInfor: TADODataSet;
    dsTemp: TADODataSet;
    dsFailures: TADODataSet;
    dsElecDevice: TADODataSet;
    dsAreasElecDevice: TADODataSet;
    comAreaDetail: TADOCommand;
    dsFailuresInDepot: TADODataSet;
    dsAreaDetail: TADODataSet;
    dsDevice: TADODataSet;
    dsDeviceType: TADODataSet;
    dsElecFee: TADODataSet;
    dsPowerSupply: TADODataSet;
    dsUserInfor: TADODataSet;
    dsOilPrice: TADODataSet;
    pvAreaInfor: TDataSetProvider;
    pvTemp: TDataSetProvider;
    pvFailures: TDataSetProvider;
    pvElecDevice: TDataSetProvider;
    pvAreasElecDevice: TDataSetProvider;
    pvDeviceType: TDataSetProvider;
    pvDevice: TDataSetProvider;
    pvAreaDetail: TDataSetProvider;
    pvFailuresInDepot: TDataSetProvider;
    pvElecFee: TDataSetProvider;
    pvPowerSupply: TDataSetProvider;
    pvUserInfor: TDataSetProvider;
    PvOilPrice: TDataSetProvider;
    dsTemp2: TADODataSet;
    pvTemp2: TDataSetProvider;
    dsAreasElecDevice2: TADODataSet;
    PvAreasElecDevice2: TDataSetProvider;
    dsTemp3: TADODataSet;
    PvTemp3: TDataSetProvider;
    dsInform: TADODataSet;
    pvInform: TDataSetProvider;
    ADODataSet: TADODataSet;
    ADOCommand: TADOCommand;
    DataSetProvider: TDataSetProvider;
    dsModifyDevice: TADODataSet;
    pvModifyDevice: TDataSetProvider;
  private
    { Private declarations }
  protected
    class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
    procedure ExecSQL(const SQLStr: WideString); safecall;
  public
    { Public declarations }
  end;

implementation

uses Unit_Main;

{$R *.DFM}

class procedure TPowerServerDM.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
  if Register then
  begin
    inherited UpdateRegistry(Register, ClassID, ProgID);
    EnableSocketTransport(ClassID);
    EnableWebTransport(ClassID);
  end else
  begin
    DisableSocketTransport(ClassID);
    DisableWebTransport(ClassID);
    inherited UpdateRegistry(Register, ClassID, ProgID);
  end;
end;

procedure TPowerServerDM.ExecSQL(const SQLStr: WideString);
begin
  comAreaDetail.CommandText:=SQLStr;
  comAreaDetail.Execute;
end;

initialization
  TComponentFactory.Create(ComServer, TPowerServerDM,
    Class_PowerServerDM, ciMultiInstance, tmApartment);
end.
